<template>
    <div class="card rdsp-card-view" data-page="currentDuty">
        <div class="card-content rank-content card-content-padding">
            <div class="rdsp-card-title">
                <div class="left-title">当前值班</div>
            </div>
            <div class="rdsp-card-con">
                <div class="currentDuty">
                    <div class="currentDuty-count">
                        <div>
                            <p class="blue" id="currentDuty-total">10</p><span>值班</span></div>
                        <div>
                            <p class="green" id="currentDuty-onDuty">10</p><span>在岗</span></div>
                        <div>
                            <p id="currentDuty-offDuty">10</p><span>离岗</span></div>
                    </div>
                    <div class="dutyState" id="dutyState-content">
                        <div class="dutyState-item leave">
                            <div class="dutyState-img">
                                <img src="{{staticPath}}img/vedio.png">
                                <span>离岗</span>
                            </div>
                            <p class="name">姓名</p>
                        </div>
                        <div class="dutyState-item">
                            <div class="dutyState-img">
                                <img src="{{staticPath}}img/vedio.png">
                            </div>
                            <p class="name">姓名</p>
                        </div>
                        <div class="dutyState-item">
                            <div class="dutyState-img">
                                <img src="{{staticPath}}img/vedio.png">
                            </div>
                            <p class="name">姓名</p>
                        </div>
                        <div class="dutyState-item">
                            <div class="dutyState-img">
                                <img src="{{staticPath}}img/vedio.png">
                            </div>
                            <p class="name">姓名</p>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</template>
<style scoped>
</style>
<script>
return {
    data: function() {
        return {}
    },
    methods: {
        getCurrentPersonnelOnDuty:function() {
                var id_org="";
                if (single_Orgid == "") {
                    id_org=userInfor.organizationIds;
                } else {
                    id_org=single_Orgid;
                }
                var total=0;
                var onDuty=0;
                var offDuty=0;
                $("#dutyState-content").empty();
              Dao.getCurrentPersonnelOnDutytext({
                      userName:userInfor.accountName,
                      deviceId:appKeyObj.deviceId,
                      orgId:id_org
              }, function (data) {
                    for(var i=0;i<data.length;i++){
                        if(data[i].uplandFlag==1){
                            onDuty++;
                            $("#dutyState-content").append(`<div class="dutyState-item">
                            <div class="dutyState-img">
                                <img src="`+picPeopleNo(data[i].headUrl)+`">
                            </div>
                            <p class="name">`+data[i].watchAccountName+`</p>
                        </div>`);
                        }
                        if(data[i].uplandFlag==0){
                            offDuty++;
                            $("#dutyState-content").append(`<div class="dutyState-item leave">
                            <div class="dutyState-img">
                                <img src="`+picPeopleNo(data[i].headUrl)+`">
                                <span>离岗</span>
                            </div>
                            <p class="name">`+data[i].watchAccountName+`</p>
                        </div>`);
                        }
                    }
                    total=onDuty+offDuty;
                   $("#currentDuty-total").empty().html(total);
                   $("#currentDuty-onDuty").empty().html(onDuty);
                   $("#currentDuty-offDuty").empty().html(offDuty);
              });
          },
    },
    on: {
        pageInit: function(e, page) {
            //inPage  sort 5 
        },
        pageAfterIn: function(e, page) {
            //inPage  sort 7 
            //Do:进入页面后
            var self = this;
            self.getCurrentPersonnelOnDuty();
        },
        pageBeforeOut: function(e, page) {
            //outPage  sort 0  
            //Do:离开页面前
        },
        pageBeforeRemove: function(e, page) {
            //outPage  sort 3  
            //Do：方法销毁、内存释放
        }
    }
}
</script>